package com.cm309.hospital.controller;

import java.io.IOException;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cm309.hospital.dao.BookingDao;
import com.cm309.hospital.model.Booking;

@WebServlet("/bookingUpd.do")
public class BookingUpd extends HttpServlet{

//	@Override
//	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
//			throws ServletException, IOException {
//		// TODO Auto-generated method stub
////		super.doGet(req, resp);
//		
//		List doctors = new ArrayList();
//		DoctorDao doctorDao = new DoctorDao();
//		doctors = doctorDao.queryAll();
//		req.setAttribute("doctors",doctors);
//		req.getRequestDispatcher("view/patientEnq.jsp").forward(req, resp);
//	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	
		Short patient_id = Short.valueOf(req.getParameter("patient_id"));
		Short doctor_schedule_id = Short.valueOf(req.getParameter("doctor_schedule_id"));

		Booking booking = new Booking();
		booking.setPatient_id(patient_id);
		booking.setDoctor_schedule_id(doctor_schedule_id);

		
		BookingDao bookingDao = new BookingDao();
		bookingDao.add(booking);

		req.getRequestDispatcher("mainPage.jsp").forward(req, resp);
	}


}
